package com.my.relation;


public class SonNew{
	String name;
	FatherNew father;
   /**
	 * @return the name
	 */
	public String getName() {
		return name;
	}
	/**
	 * @param name the name to set
	 */
	public void setName(String name) {
		this.name = name;
	}
	//关联关系中作为成员变量的类一般会在类中赋值
    public void getGift(){
        System.out.println("从"+father.getName()+"获得礼物");
    }
	/**
	 * @return the father
	 */
	public FatherNew getFather() {
		return father;
	}
	/**
	 * @param father the father to set
	 */
	public void setFather(FatherNew father) {
		this.father = father;
	}
}

